package cn.hsw.platform.controller;

import cn.hsw.platform.core.base.BaseServiceController;
import cn.hsw.platform.core.dto.ResultDto;
import cn.hsw.platform.core.util.ResultUtil;
import cn.hsw.platform.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 后台登录
 * @author 李子木
 * @date 2020-11-06
 */
@RestController
@RequestMapping("/login")
public class LoginController extends BaseServiceController<UserService> {

    @PostMapping("/password")
    public ResultDto<String> loginByPassword(@RequestParam String account,
                                                @RequestParam String password){
        String token = service.loginByPassword(account,password);

        return ResultUtil.success(token);
    }
}
